import request from '../utils/request'
// 上传课程封面接口
export const uploadImgApi = function (data) {
  return request("/VueHandler/UpLoadPicHandler", data, "post", "multipart")
}
// 添加课程基本信息
export const addCourseApi = function (data) {
  return request("/VueHandler/CourseHandler?action=add", data, "post")
}
// 获取课程列表的接口
export const getCourseApi = function (data) {
  return request("/VueHandler/CourseHandler?action=show", data, "post")
}
// 上架下架的接口
export const changeStateApi = function (ID) {
  return request("/VueHandler/CourseHandler?action=state", { ID: ID }, "post")
}
// 删除课程接口 
export const delCourseApi = function (_id, ID) {
  return request("/VueHandler/CourseHandler?action=delete", { _id: _id, ID: ID }, "post")
}
// 置顶课程接口
export const isTopApi = function (ID) {
  return request("/VueHandler/CourseHandler?action=top", { ID: ID }, "post")
}
// 请求课程基本信息
export const getCourseInfoApi = function (ID, _id) {
  return request("/VueHandler/CourseHandler?action=getcourse", { ID: ID, _id: _id }, "get")
}
// 添加目录的接口
export const addDirApi = function (data) {
  return request("/VueHandler/CourseHandler?action=AddDirectory", data, "post")
}
// 获取课程下的对应目录列表
export const getCourseDirApi = function (_id) {
  return request("/VueHandler/VideoHandler?action=finddir", { CDid: _id }, "get")
}
// 删除目录接口
export const delDirApi = function (_id, CDid) {
  return request("/VueHandler/CourseHandler?action=deleteDirectory", { _id, CDid }, "get")
}
// 给对应的目录下添加视频的接口
export const addDirVideoApi = function (data) {
  return request("/VueHandler/CourseHandler?action=addvideo", data, "get")
}
// 请求目录下的所有视频接口
export const getDirVideoApi = function (data) {
  return request("/VueHandler/VideoHandler?action=showdir", data, "get")
}